Skip to content

ERA-11397 & ERA-11399 #1290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2025
Merged

ERA-11397 & ERA-11399 #1290

merged 2 commits into from
May 8, 2025

Conversation

luixlive
Copy link
Contributor

@luixlive luixlive commented May 7, 2025

What does this PR do?

  • Make sure events with v2 schemas can be saved.
  • Make sure events with v2 schemas can be updated.
  • Add support for events with v2 schemas to be shown in the event form summary component in collections.

How does it look

Saved event with a complex v2 schema showing the form summary inside a collection:
image

Relevant link(s)

Any background context you want to provide(if applicable)

After Ernesto's fix to support storing events with our new schema format, events were saved successfully without having to do further changes to the saving flow. However, when fetching stored events that belong in a collection, the event form summary wasn't rendering properly because we never added support to v2 schemas there. All changes in this PR are related to that.

@luixlive luixlive added the deploy label May 7, 2025
@luixlive luixlive marked this pull request as draft May 7, 2025 18:39
@@ -31,10 +28,6 @@ const ContainedReportListItem = ({ cardsExpanded, onCollapse, onExpand, report }
const { t } = useTranslation('details-view', { keyPrefix: 'containedReportListItem' });

const reportFromEventStore = useSelector((state) => state.data.eventStore[report.id]);
const eventSchema = useSelector((state) => reportFromEventStore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of all the logic removed here was only to render the form summary, so it didn't make sense to keep it here. I moved it to the ReportFormSummary component keeping the parent (this component) cleaner.

@@ -0,0 +1,56 @@
import React, { useMemo } from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to divide (and conquer) the ReportFormSummary component into 3 parts:

  • The event details that are not part of the schema (reported by, priority, location, date...) those are rendered by the parent component.
  • The form summary for v1 schemas are rendered here.
  • And the form summary for v2 schemas also have their own file now 👍

@@ -1,42 +1 @@
export const CHOICE_LIST_ELEMENT_CHOICE_TYPES = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several utilities that used to be only used by the SchemaForm are now used by the ReportFormSummary so it made sense to extract them to a more general utils folder.

Copy link
Contributor

@gaboDev gaboDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🥳

@luixlive luixlive merged commit 891b0fe into develop May 8, 2025
3 checks passed
@luixlive luixlive deleted the ERA-11397 branch May 8, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants